package cn.ck.springcloud.service;

import cn.ck.springcloud.entity.Product;
import org.springframework.stereotype.Component;

import java.util.List;

//熔断处理类，注意加入Component注解
@Component
public class ProductClientServiceFallBack implements ProductClientService {
    //如果消费者调用生成者失败的熔断处理
    @Override
    public Product get(Long id) {
        return new Product(id, "id=" + id + "无数据--feign&hystrix", "无有效数据库");
    }
    @Override
    public List<Product> list() {
        return null;
    }

    @Override
    public boolean add(Product product) {
        return false;
    }
}